package com.dyna.patterns.creation.prototype;

/**
 * @author dyna
 */
public class Person implements Cloneable{

    private String username;

    private Integer age;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "username='" + username + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person person = new Person();
        person.setUsername(username);
        person.setAge(age);
        return person;
    }
}
